/**
 * 
 */
package org.store.book.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author Uday Shankar
 * 
 */
public class Cart implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private List<Book> listOfBooks = new ArrayList<Book>();
	private Address billingAddress = new Address();
	private double totalBillValue;

	/**
	 * @return the listOfBooks
	 */
	public List<Book> getListOfBooks() {
		return listOfBooks;
	}

	/**
	 * @param listOfBooks
	 *            the listOfBooks to set
	 */
	public void setListOfBooks(List<Book> listOfBooks) {
		this.listOfBooks = listOfBooks;
	}

	/**
	 * @return the billingAddress
	 */
	public Address getBillingAddress() {
		return billingAddress;
	}

	/**
	 * @param billingAddress
	 *            the billingAddress to set
	 */
	public void setBillingAddress(Address billingAddress) {
		this.billingAddress = billingAddress;
	}

	/**
	 * @return the totalBillValue
	 */
	public double getTotalBillValue() {
		return totalBillValue;
	}

	/**
	 * @param totalBillValue
	 *            the totalBillValue to set
	 */
	public void setTotalBillValue(double totalBillValue) {
		this.totalBillValue = totalBillValue;
	}

	public double getTotal() {

		double total = 0.0;
		for (Book book : listOfBooks) {
			total += book.getPrice();
		}
		return total;
	}
}
